package com.example.hzq.zqb.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

import com.example.hzq.zqb.R;

import static android.R.attr.delay;

/**
 * Created by hzq on 2017/7/14.
 */

public class WelcomeActivity extends AppCompatActivity{
    private Button finish;
    private static boolean welcomeflag=false;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.welcome);
        finish=(Button)findViewById(R.id.finish);
        new Handler().postDelayed(new Runnable(){
            public void run() {
                if(welcomeflag==false){
                    welcomeflag=true;
                    startActivity(new Intent(WelcomeActivity.this,MainActivity.class));
                    finish();
                }
            }
        }, 5000);
        finish.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(WelcomeActivity.this,MainActivity.class));
                welcomeflag=true;
                finish();
            }
        });
    }
}
